/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dbproxy;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import pojos.Descargas;
import pojos.ListWrapper;
import pojos.Pedido;
import pojos.Pojo;
import pojos.Producto;
import pojos.ProductoDetalle;
import pojos.TipoProducto;
import pojos.Usuario;
import util.Peticion;
import util.PeticionDeserializer;
import util.PojosFactory;
import util.Query;
import util.Respuesta;
import util.RespuestaDeserializer;

/**
 *
 * @author Miguel
 */
public class Main extends javax.swing.JFrame implements LogInterface {
    private Thread tServer;
    private Thread tFileServer;

    /**
     * Creates new form Main
     */
    public Main() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        root = new javax.swing.JPanel();
        lblPuerto = new javax.swing.JLabel();
        txtPuerto = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtDirArch = new javax.swing.JTextField();
        btnSelectDirArch = new javax.swing.JButton();
        txtPuertoArch = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAlog = new javax.swing.JTextArea();
        btnIniciar = new javax.swing.JButton();
        btnParar = new javax.swing.JButton();
        btnGuardarLog = new javax.swing.JButton();
        btnLimpiarLog = new javax.swing.JButton();
        btnProbar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        lblPuerto.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblPuerto.setLabelFor(txtPuerto);
        lblPuerto.setText("Puerto Comunicacion:");

        txtPuerto.setColumns(20);
        txtPuerto.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setText("Dirección Archivos: ");

        txtDirArch.setColumns(20);

        btnSelectDirArch.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnSelectDirArch.setText("...");
        btnSelectDirArch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelectDirArchActionPerformed(evt);
            }
        });

        txtPuertoArch.setColumns(20);
        txtPuertoArch.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel1.setText("Puerto Archivos: ");

        txtAlog.setColumns(30);
        txtAlog.setFont(new java.awt.Font("Courier New", 1, 12)); // NOI18N
        txtAlog.setRows(5);
        jScrollPane1.setViewportView(txtAlog);

        btnIniciar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnIniciar.setText("Iniciar");
        btnIniciar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIniciarActionPerformed(evt);
            }
        });

        btnParar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnParar.setText("Parar");
        btnParar.setEnabled(false);
        btnParar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPararActionPerformed(evt);
            }
        });

        btnGuardarLog.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnGuardarLog.setText("Guardar Log");
        btnGuardarLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarLogActionPerformed(evt);
            }
        });

        btnLimpiarLog.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnLimpiarLog.setText("Limpiar Log");
        btnLimpiarLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLimpiarLogActionPerformed(evt);
            }
        });

        btnProbar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnProbar.setText("Probar");
        btnProbar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnProbarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout rootLayout = new javax.swing.GroupLayout(root);
        root.setLayout(rootLayout);
        rootLayout.setHorizontalGroup(
            rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(rootLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(rootLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtDirArch)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSelectDirArch, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(rootLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(txtPuertoArch, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lblPuerto)
                        .addGap(18, 18, 18)
                        .addComponent(txtPuerto, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(72, 72, 72)
                        .addComponent(btnIniciar)
                        .addGap(62, 62, 62)
                        .addComponent(btnProbar)
                        .addGap(60, 60, 60)
                        .addComponent(btnParar)
                        .addGap(0, 91, Short.MAX_VALUE))
                    .addGroup(rootLayout.createSequentialGroup()
                        .addGap(293, 293, 293)
                        .addComponent(btnGuardarLog)
                        .addGap(70, 70, 70)
                        .addComponent(btnLimpiarLog))
                    .addComponent(jScrollPane1))
                .addContainerGap())
        );
        rootLayout.setVerticalGroup(
            rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(rootLayout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addGroup(rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDirArch, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(btnSelectDirArch, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPuertoArch, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(lblPuerto)
                    .addComponent(txtPuerto, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnIniciar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnProbar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnParar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(rootLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnLimpiarLog, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnGuardarLog, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(root, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(root, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnProbarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProbarActionPerformed
        probarServidor();
    }//GEN-LAST:event_btnProbarActionPerformed

    private void btnLimpiarLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimpiarLogActionPerformed
        txtAlog.setText("");
    }//GEN-LAST:event_btnLimpiarLogActionPerformed

    private void btnGuardarLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarLogActionPerformed
        try {
            FileWriter fw = new FileWriter("log-" + PojosFactory.getSdf().format(new Date()), true);
            if (txtAlog.getText() != null) {
                fw.write(txtAlog.getText());
            }
            fw.close();
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnGuardarLogActionPerformed

    private void btnPararActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPararActionPerformed
        on = false;
        pararServer();
    }//GEN-LAST:event_btnPararActionPerformed

    private void btnIniciarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIniciarActionPerformed
        on = true;
        tServer = new Thread(new Runnable() {
            @Override
            public void run() {
                startServer();
            }
        });
        tServer.start();
        tFileServer = new Thread(new Runnable() {
            @Override
            public void run() {
                startFileServer();
            }
        });
        tFileServer.start();
    }//GEN-LAST:event_btnIniciarActionPerformed

    private void btnSelectDirArchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectDirArchActionPerformed
        JFileChooser chooser = new JFileChooser(new File(".."));
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int op = chooser.showOpenDialog(root);
        if (op == JFileChooser.APPROVE_OPTION) {
            dirArch = chooser.getSelectedFile();
            txtDirArch.setText(dirArch.getAbsolutePath());
        }
    }//GEN-LAST:event_btnSelectDirArchActionPerformed
    private boolean on = true;//sirve para poder finalizar el bucle    
    private final int HILOS_MAX = 1000;//El numero maximo de hilos, sera igual al
    //numer maximo de conexiones simultaneas
    Thread[] hilos = new Thread[HILOS_MAX];
    private File dirArch;

    @Override
    public void recibirLinea(String linea) {
        synchronized (txtAlog) {
            txtAlog.append(linea + "\n");
        }
    }
    
    
    private void pararServer() {
        boolean isUp=true;
        while(isUp) {            
            if(!tServer.isAlive() && !tFileServer.isAlive()) {
                isUp=false;
            }
        }
        btnParar.setEnabled(false);
        btnIniciar.setEnabled(true);
    }

    private void startServer() {
        int puerto = -1;
        try {
            puerto = Integer.parseInt(txtPuerto.getText());
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(root, "El numero introducido "
                    + "no es valido", "Error", JOptionPane.ERROR_MESSAGE);
        }

        if (puerto != -1) {
            ServerSocket srv = null;
            try {
                srv = new ServerSocket(puerto);
                srv.setSoTimeout(2000);
            } catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }

            if (srv != null) {
                recibirLinea("Servidor iniciado en el puerto: " + puerto + "...");
                btnIniciar.setEnabled(false);
                btnParar.setEnabled(true);

                while (on) {
                    try {
                        Socket sck = srv.accept();
                        lanzarHilo(new DBProxy(sck, this), 5000);
                    } catch (SocketTimeoutException ex) {
                    } catch (IOException ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (TimeoutException ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
                try {
                    srv.close();
                    recibirLinea("Servidor parado...");
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        }
    }

    private void startFileServer() {
        int puertoArch = -1;
        try {
            puertoArch = Integer.parseInt(txtPuertoArch.getText());
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(root, "El numero introducido "
                    + "no es valido", "Error", JOptionPane.ERROR_MESSAGE);
        }

        if (puertoArch != -1) {
            ServerSocket srv = null;
            try {
                srv = new ServerSocket(puertoArch);
                srv.setSoTimeout(2000);
            } catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
            if (srv != null) {
                recibirLinea("Servidor Archivos iniciado en el puerto: " + puertoArch + "...");
                btnIniciar.setEnabled(false);
                btnParar.setEnabled(true);

                while (on) {
                    try {
                        Socket sck = srv.accept();
                        lanzarHilo(new FileServer(sck, dirArch, this), 5000);
                    } catch (SocketTimeoutException ex) {
                    } catch (IOException ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (TimeoutException ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
                try {
                    srv.close();
                    recibirLinea("Servidor Archivos parado...");
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }

    /**
     * Este metodo se queda bloqueado hasta que consigue lanzar un nuevo hilo, o
     * se lanza una excepcion en caso que la operacion exceda el tiempo
     * indicado(en milisegundos)
     *
     * @param target : El objeto Runnable a lanzar
     * @param timeout : El tiempo de espera maximo para crear el hilo
     */
    private void lanzarHilo(Runnable target, long timeout) throws TimeoutException {
        long start = System.currentTimeMillis();
        boolean hilocreado = false;
        while (!hilocreado) {
            if ((System.currentTimeMillis() - start) > timeout) {
                throw new TimeoutException("El servidor esta ocupado, intentelo mas tarde");
            }
            for (int i = 0; i < HILOS_MAX; i++) {
                if (hilos[i] == null || !hilos[i].isAlive()) {
                    hilos[i] = new Thread(target);
                    hilos[i].start();
                    hilocreado = true;
                    i = HILOS_MAX;
                }
            }
        }
    }

    /**
     * Este metodo se usa para realizar distintas pruebas con el servidor. Se
     * ejecutara al pulsar el boton probar. El codigo ira cambiando segun lo que
     * se quiera probar en el momento.
     */
    private void probarServidor() {
        Connection con = null;
        try {
            con = DriverManager.getConnection("jdbc:mysql://localhost/"
                    + "digitalify_db", "root", "");

        } catch (SQLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            if (con != null) {
                try {
                    recibirLinea("conexión con la BD exitosa");
                    con.close();
                } catch (SQLException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                recibirLinea("no se pudo conectar con la BD ");
            }

        }

//        Usuario[] usuarios=new Usuario[3];
//        for(int i=0;i<usuarios.length;i++) {
//            usuarios[i]=new Usuario("usuario"+(i+1), "abc123.", "Usuario "+(i+1), 
//                Usuario.ESTANDARD, null, "usuario"+(i+1)+"@mail.com", new Date(),
//                new Date(), 0);
//        }
//        Peticion p=new Peticion(Peticion.TIPO_MODIFICAR, Query.USUARIO_ARRAY, usuarios);
//        Respuesta resp = p.guardarPojos(con);
//        recibirLinea("Usuarios Estandar insertados: "+resp.getResultado());
//        
//        for(int i=0;i<usuarios.length;i++) {
//            usuarios[i]=new Usuario("proveedor"+(i+1), "abc123.", "Proveedor "+(i+1), 
//                Usuario.PROVEEDOR, null, "proveedor"+(i+1)+"@mail.com", new Date(),
//                new Date(), 0);
//        }
//        
//        p=new Peticion(Peticion.TIPO_MODIFICAR, Query.USUARIO_ARRAY, usuarios);
//        resp = p.guardarPojos(con);
//        recibirLinea("Usuarios Proveedor insertados: "+resp.getResultado());
//        Pedido ped=new Pedido(2, Pedido.CONFIRMADO);
//        Descargas d=new Descargas(1, 1, "", new Date(), (double)0, (double)0, null);
//        Peticion p=new Peticion(Peticion.TIPO_MODIFICAR, Query.PEDIDO_ARRAY, new Pojo[]{ped});
//        Respuesta resp = p.guardarPojos(con);
//        recibirLinea("Insertados "+resp.getResultado()+" pedidos");
//        
//        p=new Peticion(Peticion.TIPO_MODIFICAR, Query.DESCARGA_ARRAY, new Pojo[]{d});
//        resp = p.guardarPojos(con);
//        recibirLinea("Insertados "+resp.getResultado()+" descargas");
//        Query q=new Query(Query.GENERIC_LIST, 
//                new String[]{"p.*", "count(DISTINCT d.id) as `descargas`"}, 
//                new String[]{"producto p", "descargas d"});
//        //Establezco la condicion del ON del JOIN
//        q.setJoinConditions(new String[]{"p.id=d.desc_producto"});
//        //Le indico que es un LEFT JOIN
//        q.setJoinModifiers(new String[]{"LEFT"});
//        //Lo agrupo por id de producto
//        q.setGroupBy("p.id");
//        recibirLinea(q.obtenerSQL());
//        
//        Gson gs=new GsonBuilder()
//                .setDateFormat(PojosFactory.getSdf().toPattern())
//                .registerTypeAdapter(Peticion.class, new PeticionDeserializer())
//                .registerTypeAdapter(Respuesta.class, new RespuestaDeserializer())
//                .create();
//        
//        Peticion p=new Peticion(Peticion.TIPO_SELECT, q);
//        String pJson=gs.toJson(p);
//        recibirLinea("Peticion JSON: "+pJson);
//        try {
//            p=gs.fromJson(pJson, Peticion.class);
//            Respuesta resp = p.ejecutarQuery(con);
//            String jsResp=gs.toJson(resp);
//            recibirLinea("Respuesta JSON: "+jsResp);
//            resp=gs.fromJson(jsResp, Respuesta.class);
//            ArrayList<String[]> lista = ((ListWrapper)resp.getPojos()[0]).getLista();
//            for(String[] fila:lista) {
//                recibirLinea(fila[3] + "       "+ fila[fila.length -1]);
//            }
//        } catch (SQLException ex) {
//            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (ParseException ex) {
//            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
//        }

    }

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Main().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardarLog;
    private javax.swing.JButton btnIniciar;
    private javax.swing.JButton btnLimpiarLog;
    private javax.swing.JButton btnParar;
    private javax.swing.JButton btnProbar;
    private javax.swing.JButton btnSelectDirArch;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblPuerto;
    private javax.swing.JPanel root;
    private javax.swing.JTextArea txtAlog;
    private javax.swing.JTextField txtDirArch;
    private javax.swing.JTextField txtPuerto;
    private javax.swing.JTextField txtPuertoArch;
    // End of variables declaration//GEN-END:variables
}
